package com.ruoyi.baseData.controller;


import com.ruoyi.baseData.domain.TwoTest;
import com.ruoyi.baseData.domain.dto.ProcessDto;
import com.ruoyi.baseData.mapper.TwoTestMapper;
import com.ruoyi.baseData.service.ProcessService;
import com.ruoyi.common.core.domain.R;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/process")
public class ProcessController {

    @Autowired
    ProcessService processService;

//    @Resource
//    TwoTestMapper twoTestMapper;

    @PostMapping("/getProcessByPage")
    public R export(@RequestBody ProcessDto materialDto)
    {
        return R.ok(processService.getProcessByPage(materialDto));
    }

    @PostMapping("/addProcess")
    public R addTest(@RequestBody ProcessDto materialDto){
//        TwoTest twoTest = new TwoTest();
//        twoTest.setCode("测试");
//        twoTestMapper.insert(twoTest);
        processService.addProcess(materialDto);
        return R.ok("添加成功");
    }

    @PostMapping("/delProcess")
    public R delTest(@RequestBody ProcessDto materialDto){
        processService.delProcess(materialDto);
        return R.ok("删除成功");
    }

    @PostMapping("/updateProcess")
    public R updateTest(@RequestBody ProcessDto materialDto){
        processService.updateProcess(materialDto);
        return R.ok("锁定成功");
    }
}
